
package com.platform.modules.event.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.common.utils.Query;
import com.platform.modules.event.dao.MallReservationActivityDao;
import com.platform.modules.event.entity.MallReservationActivityEntity;
import com.platform.modules.event.service.MallReservationActivityService;
import com.platform.modules.event.vo.MallReservationActivityVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 预约活动Service实现类
 *
 * @author
 * @date 2023-04-20 10:26:24
 */
@Service("mallReservationActivityService")
public class MallReservationActivityServiceImpl extends ServiceImpl<MallReservationActivityDao, MallReservationActivityEntity> implements MallReservationActivityService {

    @Override
    public List<MallReservationActivityEntity> queryAll(Map<String, Object> params) {
        return baseMapper.queryAll(params);
    }

    @Override
    public Page queryPage(Map<String, Object> params) {
        //排序
        params.put("sidx", "T.id");
        params.put("asc", false);
        Page<MallReservationActivityEntity> page = new Query<MallReservationActivityEntity>(params).getPage();
        return page.setRecords(baseMapper.selectMallReservationActivityPage(page, params));
    }

    @Override
    public boolean add(MallReservationActivityEntity mallReservationActivity) {
        return this.save(mallReservationActivity);
    }

    @Override
    public boolean update(MallReservationActivityEntity mallReservationActivity) {
        return this.updateById(mallReservationActivity);
    }

    @Override
    public boolean delete(String id) {
        return this.removeById(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteBatch(String[] ids) {
        return this.removeByIds(Arrays.asList(ids));
    }

    @Override
    public List<MallReservationActivityVo> queryAllExport(Map<String, Object> params) {
        return baseMapper.queryAllExport(params);
    }
}
